import { createPinia } from 'pinia'

// http
import _http from './utils/http'

// hooks
export { usePageList } from './hooks/page-list'
export { usePageEdit } from './hooks/page-edit'

// mixins
import pageList from './mixins/page-list'
import pageEdit from './mixins/page-edit'
import dialogEdit from './mixins/dialog-edit'

// Store
export { useUserStore } from './stores/user'
export { useMenuStore } from './stores/menu'
export { useAppStore } from './stores/app'

// 组件
import Page from './components/Page.vue'
import PageMain from './components/PageMain.vue'

export const mixins = {
  pageList,
  pageEdit,
  dialogEdit,
}

export const http = _http

export default {
  install(app) {
    const store = createPinia()

    app.use(store)

    const components = [Page, PageMain]
    components.forEach(component => {
      app.component(`App${component.__name}`, component)
    })

    // axios
    app.config.globalProperties.$http = _http
    // vuexStore.registerModule('app', adminStore)
  },
}
